package com.sgb.capital.view.widget;

import android.content.Context;
import android.view.View;

import com.scwang.smart.refresh.footer.ClassicsFooter;
import com.scwang.smart.refresh.layout.api.RefreshLayout;
import com.scwang.smart.refresh.layout.constant.RefreshState;

import androidx.annotation.NonNull;

/**
 * @author: 杨畔
 * @date: 2020/12/29 10:54
 * @Description: 加载更多尾部，smartRefresh用
 */
public class MyLoadFooter extends ClassicsFooter {
    public MyLoadFooter(Context context) {
        super(context);
    }

    @Override
    public void onStateChanged(@NonNull RefreshLayout refreshLayout, @NonNull RefreshState oldState, @NonNull RefreshState newState) {
        final View arrowView = mArrowView;
        arrowView.setVisibility(GONE);
        if (!mNoMoreData) {
            switch (newState) {
                case None:
                case PullUpToLoad:
                    mTitleText.setText(mTextPulling);
                    break;
                case Loading:
                case LoadReleased:
                    mTitleText.setText(mTextLoading);
                    break;
                case ReleaseToLoad:
                    mTitleText.setText(mTextRelease);
                    break;
                case Refreshing:
                    mTitleText.setText(mTextRefreshing);
                    break;
            }
        }
    }
}
